<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>制度详情 - 智慧考勤系统</title>
    <link rel="stylesheet" href="{{ url_for('static', filename='css/style.css') }}">
    <script src="https://cdn.jsdelivr.net/npm/marked/marked.min.js"></script>
    <style>
        .policy-detail-container {
            max-width: 800px;
            margin: 0 auto;
            padding: 20px;
        }
        .policy-detail {
            background: white;
            padding: 30px;
            border-radius: 4px;
            box-shadow: 0 2px 4px rgba(0,0,0,0.1);
        }
        .policy-header {
            margin-bottom: 20px;
            border-bottom: 1px solid #eee;
            padding-bottom: 15px;
        }
        .policy-title {
            color: #2c3e50;
            margin: 0 0 10px 0;
        }
        .policy-meta {
            color: #7f8c8d;
            font-size: 0.9em;
        }
        .policy-meta span {
            margin-right: 15px;
        }
        .policy-content {
            line-height: 1.6;
        }
        .policy-content h1 {
            font-size: 1.8em;
            margin-top: 0;
        }
        .policy-content h2 {
            font-size: 1.4em;
            margin-top: 25px;
        }
        .policy-content h3 {
            font-size: 1.2em;
        }
        .policy-content ul, .policy-content ol {
            padding-left: 25px;
        }
        .policy-content li {
            margin-bottom: 5px;
        }
        .back-btn {
            display: inline-block;
            margin: 20px 0;
            padding: 10px 20px;
            background: #3498db;
            color: white;
            text-decoration: none;
            border-radius: 4px;
            transition: background 0.3s;
        }
        .back-btn:hover {
            background: #2980b9;
        }
        .error-message {
            background: #f8d7da;
            color: #721c24;
            padding: 15px;
            border-radius: 4px;
            margin: 20px 0;
        }
    </style>
</head>
<body>
    <div class="container">
        <header>
            <h1>智慧考勤系统 - 制度详情</h1>
            <p class="subtitle">了解公司规章制度，共同维护良好工作秩序</p>
        </header>

        <main class="policy-detail-container">
            <a href="/policy" class="back-btn">返回制度列表</a>
            
            {% if error %}
            <div class="error-message">
                <p>{{ error }}</p>
            </div>
            {% else %}
                <div class="policy-detail">
                    <div class="policy-header">
                        <h1 class="policy-title">{{ policy.title }}</h1>
                        <div class="policy-meta">
                            <span>分类: {{ policy.category }}</span>
                            <span>创建时间: {{ policy.created_at.strftime('%Y-%m-%d') if policy.created_at else '未知日期' }}</span>
                            <span>更新时间: {{ policy.updated_at.strftime('%Y-%m-%d %H:%M') if policy.updated_at else '未知日期' }}</span>
                        </div>
                    </div>
                    <div class="policy-content">
                        <!-- 直接在服务器端渲染Markdown内容 -->
                        {{ policy.content|safe }}
                    </div>
                </div>
            {% endif %}
            
            <a href="/policy" class="back-btn">返回制度列表</a>
        </main>

        <footer>
            <p>&copy; 2023 智慧考勤系统 | <a href="/admin">管理员入口</a></p>
        </footer>
    </div>
</body>
</html> 